
import DailyTaskSystem from "../system/DailyTaskSystem";
import Util from "../../../StartAb/Util";
import { ITask } from "./ITask";

export class TaskPassLevels extends ITask {

    _levelCnt = 0;

    constructor(lvCnt: number, rewardCoin: number) {
        super();
        this._levelCnt = lvCnt;
        this._rewardCoin = rewardCoin
    }

    description() {
        return Util.stringFormat(Util.getMulLangText("passlevelfmt"), this._levelCnt)
    }

    isDone(): boolean {
        return DailyTaskSystem.dailyInfo.todayPassLevelCount >= this._levelCnt;
    }

    progressString(): string {
        return Math.min(this._levelCnt, DailyTaskSystem.dailyInfo.todayPassLevelCount) + "/" + this._levelCnt;
    }

    progressPercent(): number {
        return Math.min(DailyTaskSystem.dailyInfo.todayPassLevelCount / this._levelCnt, 1.0);
    }

    toComplete(): void {
        DailyTaskSystem.goToPlayGame()
    }
}